<%@ page import="java.net.URLDecoder" %>
<%--
  Created by IntelliJ IDEA.
  User: Ray
  Date: 2014-12-10
  Time: 오전 9:45
  To change this template use File | Settings | File Templates.
--%>f
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <title></title>
</head>
<body>
<%
  String greeting="안녕하세요";
  Cookie[] cookies = request.getCookies();
  if(cookies!=null){
    for(Cookie cookie : cookies){
      if(cookie.getName().equals("YourGreeting")){
        greeting = URLDecoder.decode(cookie.getValue(),"utf-8");
        break;
      }
    }
  }
%>
<%=greeting%> <br />
<form action="/SaveGreet" method="post">
  다음에 오시면 어떻게 인사를 해드릴까요?<br/>
  <input type="text" name="greeting" />
  <input type="submit" value="설정"/>
</form>

<form action="/DeleteGreet" method="post">
  설정한 인사 지우기<br/>
  <input type="submit" value="설정"/>
</form>
</body>
</html>
